<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>数组去重</title>
		<script>
			var arr = [20,1,56,54,20,31,1,54];
			var newArr = [];
			for (var i = 0; i < arr.length; i++) {
				var bool = true;
				for (var j = 0; j < newArr.length; j++) {
					if (arr[i] === newArr[j]) {
						bool = false;
					}
				}
				if (bool) {
					newArr[newArr.length] = arr[i];
				}
			}
			console.log(newArr);
		</script>
	</head>
	<body>
	</body>
</html>
